//
//  YMPathManager.m
//  QuPaiYunDemo
//
//  Created by 占益民 on 2018/3/29.
//  Copyright © 2018年 占益民. All rights reserved.
//

#import "YMPathManager.h"
@implementation YMPathManager


#pragma mark -  Public
+ (NSString *)ym_rootPath{
    return [[self rootPath] stringByAppendingString:@"com.allen.demo"];
}


+ (NSString *)ym_cachePath{
    return [[self cachePath] stringByAppendingString:@"com.allen.demo"];
}

+ (NSString *)ym_compositionRootDir{
    return [[self ym_rootPath] stringByAppendingString:@"composition"];
}
+ (NSString *)ym_relativeRootPath{
    return @"Documents/com.allen.demo";
}

+ (NSString *)ym_createRecrodDir {
    return [[self rootPath] stringByAppendingPathComponent:@"record"];
}


+ (void)ym_clearDir:(NSString *)dirPath {
    [[NSFileManager defaultManager] removeItemAtPath:dirPath error:nil];
    [[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:nil];
}


+ (NSString *)ym_createMagicRecordDir {
    return [[self rootPath] stringByAppendingPathComponent:@"magicRecord"];
}

+ (NSString *)ym_createResourceDir {
    return [[self rootPath] stringByAppendingPathComponent:@"QPRes"];
}

+ (NSString *)ym_resourceRelativeDir {
    return [[self rootPath] stringByAppendingPathComponent:@"QPRes"];
}



+ (NSString *)ym_uuidString{
    CFUUIDRef puuid = CFUUIDCreate(nil);
    CFStringRef uuidString = CFUUIDCreateString(nil, puuid);
    NSString * result = (NSString *)CFBridgingRelease(CFStringCreateCopy(NULL, uuidString));
    CFRelease(puuid);
    CFRelease(uuidString);
    return result;
}

#pragma mark - Private
+ (NSString *)rootPath{
    return NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
}

+ (NSString *)cachePath{
    return NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
}


@end
